#cs ----------------------------------------------------------------------------
	
	$Author: bjoern.kaiser $
	$LastChangedDate: 2008-05-05 13:40:01 +0000 (Mon, 05 May 2008) $
	
	Script Function:
	target registry access functions
	
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include-once

Func _reg_Load($strTarget = "C:")
	Local $intRc
	Local $intI
	Local $arrHives[2]
	$arrHives[0] = "SOFTWARE"
	$arrHives[1] = "SYSTEM"
	
	_log("I", "Loading target registry")
	
	For $strEach In $arrHives
		$intI += 1
		_log("D", "Loading " & $strEach & " registry hive")
		$intRc = RunWait("reg load HKLM\TARGET_" & $strEach & " " & $strTarget & "\Windows\System32\config\" & $strEach)
		
		If Not $intRc Then
			_log("O", "Successfully loaded " & $strEach & " registry hive")
		Else
			_log("F", "Reg Load of " & $strEach & " registry hive")
			SetError($intRc)
			Return 0
		EndIf
		
	Next
	
	Return 1
EndFunc   ;==>_reg_Load

Func _reg_UnLoad()
	Local $intRc
	Local $arrHives[2]
	$arrHives[0] = "SOFTWARE"
	$arrHives[1] = "SYSTEM"
	
	_log("I", "Unloading target registry")
	For $strEach In $arrHives
		_log("D", "Unloading " & $strEach & " registry hive")
		$intRc = RunWait("reg unload HKLM\TARGET_" & $strEach)
		
		If Not $intRc Then
			_log("O", "Successfully unloaded " & $strEach & " registry hive")
		Else
			_log("F", "Reg Unload of " & $strEach & " registry hive")
		EndIf
		
	Next

	Return $intRc
EndFunc   ;==>_reg_UnLoad